package com.yiyi.credit.manage.abutment.common.enums;


public enum ProductStatus {

    PUBLISHING(1, "待发布"),
    PUBLISHED(2, "已发布"),
    BACK_TO_MODIFY(3, "退回修改"),
    REFUSED(4, "已拒绝"),
    BLACK_OUT(5, "已下架"),
    DELETE(6, "已删除");


    private final int key;


    private final String value;

    ProductStatus(int key, String value) {
        this.key = key;
        this.value = value;
    }

    public static ProductStatus getEnumByKey(int key) {
        for (ProductStatus item : ProductStatus.values()) {
            if (item.getKey() == key) {
                return item;
            }
        }
        throw new RuntimeException(String.format("未找到对应的产品状态:{%s}", key));
    }

    public int getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

}
